#include "Dynamicobject.h"

DynamicObject::DynamicObject()
{
}

void DynamicObject::UpdateImagePosition()
{
    qreal modify = 6 * (m_completeness / 100);
    QPointF pos;
    pos.setX(m_pos.x * 6);
    pos.setY(m_pos.y * 6);

    switch(m_direction)
    {
    case DynamicObject::eNorth :
        pos.setY(pos.y() - modify);
        break;
    case DynamicObject::eSouth :
        pos.setY(pos.y() + modify);
        break;
    case DynamicObject::eWest :
        pos.setX(pos.x() - modify);
        break;
    case DynamicObject::eEast :
        pos.setX(pos.x() + modify);
        break;
    }

    SetImagePosition(pos);
}

void DynamicObject::move()
{
    switch(m_direction)
    {
    case DynamicObject::eNorth :
        --m_pos.y;
        break;
    case DynamicObject::eSouth :
        ++m_pos.y;
        break;
    case DynamicObject::eWest :
        --m_pos.x;
        break;
    case DynamicObject::eEast :
        ++m_pos.x;
        break;
    }
}
